const express = require('express');

const router = express.Router();

router.all('/moldchecking/submit', (req, res) => {
    console.log(req.body)
    
    let res_body = req.body
    res_body.status = 0
    res_body.msg = "成功"
    res.json(
        res_body
    );
});

router.all('/moldchecking/submit2', (req, res) => {
    console.log(req.body)
    
    let res_body = req.body
    res_body.status = 0
    res_body.msg = "成功"
    res.json(
        res_body
    );
});

router.all('/tilepair/get_pairs', (req, res) => {
    console.log(req.query)
    let targetMachine = req.query.targetMachine

    let res_body = {
        "status": 0,
        "msg": "成功",
        
        "tilePairs":[{
            "rowid":1,
            "upperImageId":11111111,
            "upperNumber":"upTile",
            "underNumber":"undTile",
            "underImageId":22222222
        },{
            "rowid":2,
            "upperImageId":33333333,
            "upperNumber":"upTile",
            "underNumber":"undTile",
            "underImageId":44444444
        }
        ]
    }
    res.json(
        res_body
    );
});

router.all('/machine/availablemachines', (req, res) => {
    console.log(req.query)

    let res_body = {
        "status": 0,
        "msg": "成功",
        
        "availableMachines":["101","102","103","104","105"]
    }
    res.json(
        res_body
    );
});

router.all('/machine/productspec', (req, res) => {
    console.log(req.query)
    let machineId = req.query.machineId

    let res_body = {
        "status": 0,
        "msg": "成功",
        
        "machineId":"303",
        "TIREMASTERPRODOCESSR":{
            "SpecCode":"PK32A",
            "MoldCode":"235/45R18T05QAZ",
            "DOT":"3323",
            "CureBladder":"18FP380XA",
            "CureRinger4":"71E8010",
            "Plug":"1"//
        }
    }
    res.json(
        res_body
    );
});


router.all('/machine/productspec2', (req, res) => {
    console.log(req.query)
    let machineId = req.query.machineId

    let res_body = {
        "status": 0,
        "msg": "成功",
        
        "DOT":"333333",//DOT号
        "CureBladder":"222222",//胶囊号
        "CureRinger5":"111111",//上瓦环号
        "CureRinger4":"111112/22",//下瓦环号
        "MoldCode":"PSR225/50R17ER33KZ",//模具号
        "SpecCode" : machineId,//规格编码
        "Plug":"0"//
    }
    res.json(
        res_body
    );
});

router.all('/appupgrade/latest_version', (req, res) => {
    console.log(req.query)
    let machineId = req.query.machineId

    let res_body = {
        "status": 0,
        "msg": "成功",
        
        "version":"2.19",//DOT号
        "url":"222222",//胶囊号
    }
    res.json(
        res_body
    );
});



module.exports = router;

